package com.ruoyi.mymod.controller.message;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.mymod.service.IMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.domain.AjaxResult;

import java.text.ParseException;

import static com.ruoyi.common.core.domain.AjaxResult.success;


/**
 * 测试功能
 *
 * @author ruoyi
 */
@RestController
@RequestMapping("/message")
public class MessageController extends BaseController
{

    @Autowired
    private IMessageService messageService;
    /**
     * 获取菜单列表
     */
    @GetMapping("/getMessage")
    public AjaxResult getMessage(@RequestParam(required = false) String ucode, @RequestParam(required = false) String area, @RequestParam(required = false) String feed) throws Exception {
        Integer alevel=0;
        String acode=null;
        Integer flevel=0;
        String fcode=null;
        if (area!=null){
            acode=area.split("/")[0];
            alevel=Integer.parseInt(area.split("/")[1]);
        }
        if (feed!=null){
            fcode=feed.split("/")[0];
            flevel=Integer.parseInt(feed.split("/")[1]);
        }
        String  message = messageService.selectMessage(ucode,acode,alevel,fcode,flevel);
        return success(message);
    }


}
